// 添加学生
let addStudentBtn = $('#add-student-btn');
addStudentBtn.on('click', function () {
    let saccount = $('#sNo1').val();
    let sname = $('#sname1').val();
    let classid = +$('#sclass1').val();
    axios({
        url:'/addStudent',
        method:'post',
        data:{
            saccount,
            sname,
            classid
        }
    }).then(resp => {
        alert(resp.data.msg);
    })
});

// 添加老师
let addTeacherBtn = $('#add-teacher-btn');
addTeacherBtn.on('click', () => {
    let taccount = $('#tNo1').val();
    let tpwd = $('#tpwd1').val();
    let tname = $('#tname1').val();
    let classid = +$('#tclass1').val();
    console.log(taccount, tpwd, tname, classid);
    axios({
        url:'/addTeacher',
        method:'post',
        data:{
            taccount,
            tpwd,
            tname,
            classid
        }
    }).then(resp => {
        alert(resp.data.msg);
    })
})

// 退出登录
let backTo = $('#back');
backTo.on('click', e=>{
    let isTrue = confirm('确定要退出吗？');
    if (isTrue) {
        location.href = '/';
    }
})